<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitUpdate87 extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('boxes', function (Blueprint $table) {
            
            $table->boolean('is_invite_enabled')->default(0)->index()->comment('是否开启邀请机制');
            $table->json('invite_rule')->nullable()->comment('邀请规则');

            $table->integer('invite_user_total')->default(0)->index()->comment('拉新用户数');
            $table->integer('join_user_total')->default(0)->index()->comment('参与用户数');

        });

        Schema::table('yfs_activity', function (Blueprint $table) {
            
            $table->boolean('is_invite_enabled')->default(0)->index()->comment('是否开启邀请机制');
            $table->json('invite_rule')->nullable()->comment('邀请规则');

            $table->integer('invite_user_total')->default(0)->index()->comment('拉新用户数');
            $table->integer('join_user_total')->default(0)->index()->comment('参与用户数');
            
        });

        Schema::table('invite_records', function (Blueprint $table) {

            $table->integer('node_invite_index')->nullable()->index()->comment('在该活动中所属邀请序号');
            
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
